<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class Circle extends Model
{
	use HasDateTimeFormatter;

    protected $fillable = [
        'user_id',
        'name',
        'area',
        'intro',
        'circle_category_id',
        'logo',
        'bg_image'
    ];

    protected $attributes = [
       'audit_status' => 1
    ];

    public function category()
    {
        return $this->belongsTo(CircleCategory::class,'circle_category_id');
    }

    public function user()
    {
        return $this->belongsTo(User::class,'user_id');
    }

    public function article()
    {
        return $this->hasMany(Article::class,'circle_id','id');
    }

    public function people()
    {
        return $this->hasMany(UserCircle::class,'circle_id','id');
    }

}
